<template>
  <div class="admin-login">
    <h2>管理员登录</h2>
    <form @submit.prevent="login">
      <input v-model="username" placeholder="用户名" />
      <input v-model="password" type="password" placeholder="密码" />
      <button type="submit">登录</button>
    </form>
  </div>
</template>

<script>
export default {
  name: 'AdminLogin',
  data() {
    return {
      username: '',
      password: ''
    }
  },
  methods: {
    login() {
      if (this.username === 'admin' && this.password === '123456') {
        localStorage.setItem('adminToken', 'xyz789');
        alert('登录成功');
        this.$router.push('/page-ten/admin/dashboard/settings');
      } else {
        alert('用户名或密码错误');
      }
    }
  }
}
</script>